/**
 * 公共基础接口封装
 */
import request from '@/utils/request'

// 获取列表
export const getGoods = (params) => {
  return request({
    method: 'GET',
    url: '/goods',
    params
  })
}

// 根据id获取详情
export const getGoodsById = (id) => {
  return request({
    method: 'GET',
    url: `/goods/${id}`
  })
}

// 添加
export const addGoods = (data) => {
  return request({
    method: 'POST',
    url: '/goods',
    data
  })
}

// 编辑
export const editGoods = (id, data) => {
  return request({
    method: 'PUT',
    url: `/goods/${id}`,
    data
  })
}

// 删除
export const deleteGoods = (id) => {
  return request({
    method: 'DELETE',
    url: `/goods/${id}`
  })
}
